using System;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UserInterface.Misc;

namespace UserInterface
{
    public partial class DownloadTempAttachment : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string data = Request.QueryString["data"];
            if (data == null)
            {
                return;
            }
            string filePath = EncryptTools.Decrypt(data);
            string fileName = Request.QueryString["name"];
            string contentType = Request.QueryString["type"];

            Response.AddHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
            Response.ContentType = contentType;
            Response.WriteFile(filePath);
            Response.Flush();
            Response.End();
        }
    }
}
